package com.example.demo.configuration.excel;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;
import org.springframework.util.unit.DataUnit;

import javax.servlet.MultipartConfigElement;

/**
 * @description:
 * @author: cj
 * @create: 16-03-08 16:45:45
 */
@Configuration
public class FileConfig {
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        DataSize maxRequestSize = DataSize.of( 200, DataUnit.MEGABYTES );
        factory.setMaxRequestSize( maxRequestSize );
        factory.setMaxFileSize( maxRequestSize );
        return factory.createMultipartConfig();
    }
}
